""" 用于注册加密 和 cos-uid 生成 """
import hashlib
import uuid
from django.conf import settings

# SECRET_KEY 加盐
def md5(data_string):
       
    obj = hashlib.md5(settings.SECRET_KEY.encode('utf-8'))
    obj.update(data_string.encode('utf-8'))

    return obj.hexdigest()

def uid(string):
    data = "{}-{}".format(str(uuid.uuid4()),string)
    return md5(data)

